<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>


<body>
  <div id="test"></div>
</body>



<script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/react/18.2.0/umd/react.production.min.js"></script>
<script
  src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/babel-standalone/6.26.0/babel.min.js"></script>
<script type="text/javascript" src="../js/prop-types.js"></script>

<script type="text/babel"> //必须声明 babel
  class Person extends React.Component {
    myRef = React.createRef()
    showData = () => {
      console.log(this.myRef.current.value);
      
      // alert()
    }
    showData2=(e)=>{
      alert(e.target.value)
    }

    render () {
      return (
        <div> 
          <input type="text" plaseholder="请输入内容" ref={this.myRef} />
          <button onClick={this.showData}>点击弹窗</button>
          <input type="text" plaseholder="请输入内容"  onBlur={this.showData2} />

        </div>
      )
    }
  }
  ReactDOM.render(<Person />, document.getElementById('test'))
</script>

</html>